package com.kaifamiao.N0726;

import java.util.Random;

public class Tress01 {
    public static void main(String[] args) {
        Tree tree = new Tree();

        Random random = new Random();
        for(int i = 1;i<=10;i++){

            int robot = random.nextInt(3);
            switch(robot){
                case 0:
                    tree.water();
                    break;
                case 1:
                    tree.health-=80;
                    break;
                case 2:
                    tree.health +=30;
                    break;
            }

        }
        if(tree.health > 0){
            System.out.println("树的健康值为：" + tree.health);
        }else{
            System.out.println("树死了，树的健康值为：" + tree.health);
        }

    }

}
